var pathFinding = require('./');
var path = require('path');

var pf = new pathFinding.pathFinding();
let ret = [];

// pf.initMapByLengthAndWidth(1024, 1024);
let pathFile = path.join(__dirname, 'path');
pf.initMapByFile(pathFile);
const mapLength = pf.mapLength();
const mapWidth = pf.mapWidth();
console.log('mapLength', mapLength, '   mapWidth', mapWidth);

let si = Date.now();
pf.initJpInfo(); //寻路前必须更新跳点缓存
console.log("initJpInfoCostTm--------   ", Date.now() - si, "ms");

let ss = Date.now();
for (let i = 0; i < 1000; ++i) {
    ret = pf.search(1, 6, 98, 75);
}
console.log('ret', JSON.stringify(ret));
console.log('searchTm', Date.now() - ss, "ms");

//pf.setMap(0, 0, 0, 0, 1); //左下x，左下y，右上x，右上y 矩形复制 不更新跳点缓存
//pf.setMapAndUpdateJp(0, 0, 0, 0, 1); //更新跳点缓存
